package org.jeecg.modules.wlhy.tlaccount.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.wlhy.tlaccount.entity.HyTlAccountSysRecord;
import org.jeecg.modules.wlhy.tlaccount.service.IHyTlAccountSysRecordService;
import org.jeecg.modules.wlhy.utils.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

 /**
 * @Description: hy_tl_account_sys_record
 * @Author: jeecg-boot
 * @Date:   2022-10-21
 * @Version: V1.0
 */
@Api(tags="hy_tl_account_sys_record")
@RestController
@RequestMapping("/tlaccount/hyTlAccountSysRecord")
@Slf4j
public class HyTlAccountSysRecordController extends JeecgController<HyTlAccountSysRecord, IHyTlAccountSysRecordService> {
	@Autowired
	private IHyTlAccountSysRecordService hyTlAccountSysRecordService;

	 @Autowired
	 private UserUtil userUtil;

	@ApiOperation(value="hy_tl_account_sys_record-分页列表查询", notes="hy_tl_account_sys_record-分页列表查询")
	@GetMapping(value = "/list")
	public Result<?> queryPageList(HyTlAccountSysRecord hyTlAccountSysRecord,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		if(!userUtil.isSys()){
			return Result.error("无权限操作");
		}
		QueryWrapper<HyTlAccountSysRecord> queryWrapper = QueryGenerator.initQueryWrapper(hyTlAccountSysRecord, req.getParameterMap());
		Page<HyTlAccountSysRecord> page = new Page<HyTlAccountSysRecord>(pageNo, pageSize);
		IPage<HyTlAccountSysRecord> pageList = hyTlAccountSysRecordService.page(page, queryWrapper);
		return Result.OK(pageList);
	}

}
